package Lee_code;

public class Lee_55 {
    int last_index;
    boolean sign;
    public boolean canJump(int[] nums) {
        last_index = nums.length-1;
        sign = false;
        dfs(nums, 0);

        return sign;
    }
    public void dfs(int[] nums, int now_index)
    {
        if(now_index>last_index)
            return;
        if(now_index==last_index)
            sign=true;
        else
        {
            int max_jump = nums[now_index];
            for(int i=1; i<=max_jump; i++)
            {
                dfs(nums, now_index+i);
            }
        }
    }
}
